package com.chain.qs.modules.biz.converter;

import com.chain.qs.modules.biz.entity.Equipment;
import com.google.common.collect.Lists;
import org.springframework.core.convert.converter.Converter;

import java.util.ArrayList;
import java.util.List;

/**
 * 设备类型自动转换，用于将字符串数组转换成设备List
 * @author Wang zhiping
 */
public class StringArrrayToEquipmentList implements Converter<String[],List<Equipment>> {
    @Override
    public List<Equipment> convert(String[] strings) {

        List<Equipment> list = Lists.newArrayList();
        Equipment equipment;
        for(String s:strings){
            equipment = new Equipment();
            equipment.setId(s);
            list.add(equipment);
        }
        return  list;
    }
}
